<template>
	<view class="container">
		<view class="list-cell b-b m-t" hover-class="cell-hover" :hover-stay-time="50">
			<text class="cell-tit">头像</text>
			<text class="cell-tip">
				<view class="portrait-box">
					<image
						class="portrait"
						src="/static/images/logo.png"
					></image>
				</view>
			</text>
			<text class="cell-more iconfont icon-you"></text>
		</view>
		<view class="list-cell b-b" hover-class="cell-hover" :hover-stay-time="50">
			<text class="cell-tit">手机号</text>
			<text class="cell-tip">{{user.tel}}</text>
			<text class="cell-more iconfont icon-you"></text>
		</view>
		<view class="list-cell b-b" @click="navTo('/pages/user/bank')" hover-class="cell-hover" :hover-stay-time="50">
			<text class="cell-tit">我的银行卡</text>
			<text class="cell-more iconfont icon-you"></text>
		</view>
		<view class="list-cell b-b" @click="navTo('/pages/user/douyin')" hover-class="cell-hover" :hover-stay-time="50">
			<text class="cell-tit">我的抖音号</text>
			<text class="cell-tip">{{user.douyin}}</text>
			<text class="cell-more iconfont icon-you"></text>
		</view>
		<view class="list-cell b-b" @click="navTo('/pages/user/alipay')" hover-class="cell-hover" :hover-stay-time="50">
			<text class="cell-tit">我的支付宝</text>
			<text class="cell-more iconfont icon-you"></text>
		</view>
		<view class="list-cell b-b" @click="navTo('/pages/user/pw')" hover-class="cell-hover" :hover-stay-time="50">
			<text class="cell-tit">登录密码</text>
			<text class="cell-more iconfont icon-you"></text>
		</view>
		<!-- <view class="list-cell b-b" @click="navTo('/pages/user/dpw')" hover-class="cell-hover" :hover-stay-time="50">
			<text class="cell-tit">支付密码</text>
			<text class="cell-more iconfont icon-you"></text>
		</view> -->
		<view class="list-cell log-out-btn" @click="toLogout">
			<text class="cell-tit">退出登录</text>
		</view>
	</view>
</template>

<script>
	import {
	    mapMutations
	} from 'vuex';
	export default {
		data() {
			return {
				version:"",
				user:{}
			};
		},
		onLoad() {
			this.$request.post("/member/getMember", {
				dataType: 'json',
				responseType: 'text'
			})
			.then(res => {
				this.user = res.data.json;
			})
		},
		methods:{
			...mapMutations(['logout']),

			navTo(url){
				uni.navigateTo({
					url
				})
			},
			//退出登录
			toLogout(){
				uni.showModal({
				    content: '确定要退出登录么',
				    success: (e)=>{
				    	if(e.confirm){
				    		this.$api.logout();
				    		setTimeout(()=>{
				    			uni.reLaunch({
				    				url:"/pages/login/login"
				    			})
				    		}, 200)
				    	}
				    }
				});
			},
			clearCache(){
				uni.showLoading({
				    title: '清理中...',
					mask:true
				});
				setTimeout(()=>{
					this.$api.msg("清除成功");
					uni.hideLoading();
				},2000);
			}
		}
	}
</script>

<style lang='scss'>
	.list-cell{
		display:flex;
		align-items:center;
		padding: 20upx $page-row-spacing;
		line-height:60upx;
		position:relative;
		background: #fff;
		justify-content: center;
		&.log-out-btn{
			margin-top: 40upx;
			.cell-tit{
				color: $uni-color-primary;
				text-align: center;
				margin-right: 0;
			}
		}
		&.cell-hover{
			background:#fafafa;
		}
		&.b-b:after{
			left: 30upx;
		}
		&.m-t{
			margin-top: 16upx;
		}
		.cell-more{
			align-self: baseline;
			font-size:$font-lg;
			color:$font-color-light;
			margin-left:10upx;
		}
		.cell-tit{
			flex: 1;
			font-size: $font-base + 2upx;
			color: $font-color-dark;
			margin-right:10upx;
		}
		.cell-tip{
			font-size: $font-base;
			color: $font-color-light;
			image{
				width: 60upx;
				height: 60upx;
				/* border-radius: 100%; */
				/* margin: 10upx 0; */
			}
		}
		switch{
			transform: translateX(16upx) scale(.84);
		}
	}
	.portrait-box{
		height: 60rpx;
	}
</style>
